package app

const (
	SQL_CREATE_TABLE_USER = "CREATE TABLE IF NOT EXISTS `user` (\n" +
		"`user_id`          INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE,\n" +
		"`user_name`         TEXT NOT NULL UNIQUE,\n" +
		"`email`         TEXT ,\n" +
		"`phone`         TEXT,\n" +
		"`password`   TEXT NOT NULL,\n" +
		"`user_type`   TEXT NOT NULL,\n" +
		"`status`   TEXT NOT NULL,\n" +
		"`desc`   TEXT ,\n" +
		"`create_time`  INTEGER NOT NULL\n" +
		");"

	SQL_CREATE_TABLE_DeviceGroup = "CREATE TABLE IF NOT EXISTS `device_group` (\n" +
		"`device_group_id`          INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE,\n" +
		"`device_group_name`         TEXT NOT NULL UNIQUE,\n" +
		"`desc`   TEXT ,\n" +
		"`device_count`   INTEGER ,\n" +
		"`show_index`   INTEGER NOT NULL,\n" +
		"`create_time`  INTEGER NOT NULL\n" +
		");"

	SQL_CREATE_TABLE_Device = "CREATE TABLE IF NOT EXISTS `device` (\n" +
		"`device_id`          INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE,\n" +
		"`device_group_id`         INTEGER NOT NULL,\n" +
		"`name`   TEXT ,\n" +
		"`code`   TEXT ,\n" +
		"`desc`   TEXT ,\n" +
		"`otg`   TEXT ,\n" +
		"`ip`   TEXT ,\n" +
		"`port`   TEXT ,\n" +
		"`status`   TEXT ,\n" +
		"`latest_connect`   TEXT ,\n" +

		"`show_index`   INTEGER NOT NULL,\n" +
		"`create_time`  INTEGER NOT NULL\n" +
		");"

	SQL_CREATE_TABLE_task = "CREATE TABLE IF NOT EXISTS `task` (\n" +
		"`task_id`          INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE,\n" +

		"`name`   TEXT ,\n" +
		"`desc`   TEXT ,\n" +
		"`status`   TEXT ,\n" +

		"`device_group_id`   INTEGER ,\n" +
		"`device_group_name`   TEXT ,\n" +
		"`task_config_id`   INTEGER ,\n" +
		"`config`   		TEXT ,\n" +
		"`product_path`   TEXT ,\n" +

		"`create_time`  INTEGER NOT NULL\n" +
		");"

	SQL_CREATE_TABLE_task_group = "CREATE TABLE IF NOT EXISTS `task_group` (\n" +
		"`task_group_id`          INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE,\n" +
		"`device_group_id`   INTEGER ,\n" +
		"`product_path`   TEXT ,\n" +

		"`appointment_time`   		INTEGER ,\n" +
		"`stop_time`   		INTEGER ,\n" +
		"`hold_sec`   		INTEGER ,\n" +
		"`retry`   		INTEGER ,\n" +

		"`name`   TEXT ,\n" +
		"`desc`   TEXT ,\n" +
		"`status`   TEXT ,\n" +

		"`create_time`  INTEGER NOT NULL\n" +
		");"

	SQL_CREATE_TABLE_TaskProduct = "CREATE TABLE IF NOT EXISTS `product` (\n" +
		"`product_id`          INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE,\n" +

		"`task_id`   INTEGER ,\n" +
		"`device_group_id`   INTEGER ,\n" +
		"`device_group_name`   TEXT ,\n" +

		"`account`   		TEXT ,\n" +
		"`product_code`   		TEXT ,\n" +
		"`product_title`   		TEXT ,\n" +
		"`release_time`   		TEXT ,\n" +
		"`is_start`   		TEXT ,\n" +
		"`task_config`   		TEXT ,\n" +

		"`create_time`  INTEGER NOT NULL\n" +
		");"

	SQL_CREATE_TABLE_TaskLog = "CREATE TABLE IF NOT EXISTS `task_log` (\n" +
		"`task_log_id`          INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE,\n" +
		"`task_group_id`   INTEGER ,\n" +

		"`device_group_id`   INTEGER ,\n" +
		"`device_group_name`   TEXT ,\n" +
		"`device_id`   INTEGER ,\n" +
		"`device_code`   TEXT ,\n" +
		"`device_name`   TEXT ,\n" +

		"`status`   TEXT ,\n" +

		"`account`   		TEXT ,\n" +
		"`product_code`   		TEXT ,\n" +
		"`product_title`   		TEXT ,\n" +
		"`is_start`   		TEXT ,\n" +
		"`addr`   		TEXT ,\n" +
		"`release_time`   		TEXT ,\n" +
		"`hold_sec`   		INTEGER ,\n" +
		"`retry`   		INTEGER ,\n" +
		"`send_count`   		INTEGER ,\n" +

		"`appointment_time`   		INTEGER ,\n" +
		"`stop_time`   		INTEGER ,\n" +
		"`start_time`   		INTEGER ,\n" +
		"`end_time`   		INTEGER ,\n" +
		"`img`   		TEXT ,\n" +

		"`create_time`  INTEGER NOT NULL\n" +
		");"

	SQL_CREATE_TABLE_TaskConfig = "CREATE TABLE IF NOT EXISTS `task_config` (\n" +
		"`config_id`          INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE,\n" +
		"`name`   TEXT NOT NULL,\n" +
		"`desc`   TEXT,\n" +
		"`config`   TEXT,\n" +
		"`is_default`   TEXT,\n" +
		"`show_index`   INTEGER NOT NULL,\n" +
		"`create_time`  INTEGER NOT NULL\n" +
		");"
)
